package com.ormlite.activity.tool.button.movie;

import android.app.Activity;
import android.view.View;

import com.ormlite.activity.check.CheckMovieActivity;
import com.ormlite.activity.tool.DatabaseUtils;
import com.ormlite.pojo.Movie;

public class RemoveMovieButton implements View.OnClickListener {

	private final Activity checkMovieActivity;
	private final Movie movie;

	public RemoveMovieButton(CheckMovieActivity checkMovieActivity, Movie movie) {
		this.checkMovieActivity = checkMovieActivity;
		this.movie = movie;
	}

	@Override
	public void onClick(View v) {
		DatabaseUtils.removeMovie(movie);
		checkMovieActivity.finish();
		checkMovieActivity.startActivity(checkMovieActivity.getIntent());
	}
}
